package 暑假实习面试.腾讯面试题;

import java.util.*;

public class No2 {

    private static class Pair{
        private Integer key;
        private Integer value;

        public Pair(Integer key, Integer value) {
            this.key = key;
            this.value = value;
        }

        public Integer getKey() {
            return key;
        }

        public Integer getValue() {
            return value;
        }

        public void setKey(Integer key) {
            this.key = key;
        }
    }

    public static void main(String[] args) {

        Scanner input=new Scanner(System.in);

        //用户数量
        int userCount=input.nextInt();
        //信息量
        int smsCount=input.nextInt();
        //每个用户的间隔时间
        int[] userItemTime=new int[userCount];
        //Pair->(下一个发送时间,用户下标)
        PriorityQueue<Pair> priorityQueue=new PriorityQueue<>((o1,o2)->{
            if(o1.getKey().equals(o2.getKey())){
                return o1.getValue()-o2.getValue();
            }
            return o1.getKey()-o2.getKey();
        });

        for (int i = 0; i < userCount; i++) {
            userItemTime[i]=input.nextInt();
            //用户的下一个发送时间和用户编号
            priorityQueue.add(new Pair(userItemTime[i],i));
        }

        int count=0;
        int[] result=new int[smsCount];

        while (count<smsCount){

            Pair pair = priorityQueue.poll();

            result[count++]=pair.getValue();

            pair.setKey(pair.getKey()+userItemTime[pair.getValue()]);

            priorityQueue.add(pair);

        }

        for (int i = 0; i < smsCount; i++) {
            System.out.println(result[i]+1);
        }

    }

}
